<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/classes/CommonHelper.class.jsp" %>
<%@ include file="/classes/DBHelper.class.jsp" %>
<%@ include file="/classes/GUID.class.jsp"%>
<%@ include file="/classes/MessageUtil.class.jsp"%>

<%
	request.setCharacterEncoding("UTF-8");
	String guid = getParameter(request,"guid");
	String question = getParameter(request,"question");
	String answer = getParameter(request,"answer");
	String type_id = getParameter(request,"type_id");
	String dept_name = getParameter(request,"dept_name");
	
	if(nullOrEmpty(guid)){
		
		out.print(getAlertMessage(request,"参数错误！","zspj_list.jsp?r="+new Date().getTime(),true));
		return;
	}
	
	if(nullOrEmpty(question)||nullOrEmpty(answer)||nullOrEmpty(type_id)){
		out.print(getAlertMessage(request,"所有选项都是必填选项！","zspj_list.jsp?r="+new Date().getTime(),true));
		return;
	}
	
	String sql = "update APP_ZSPJ set question = ?,answer = ?,type_id = ?,dept_name = ? where guid = ?";
	int count = executeUpdate(sql,new Object[]{question,answer,type_id,dept_name,guid});
	if(count>0){
		out.print(getAlertMessage(request,"修改成功！","zspj_list.jsp?r="+new Date().getTime(),true));
		return;
	}else{
		out.print(getAlertMessage(request,"操作失败！","zspj_list.jsp?r="+new Date().getTime(),true));
		return;
	}
	
%>